import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HatchVO, HatchForm, HatchQuery } from '@/api/farm/hatch/types';

/**
 * 查询小鸡孵化列表
 * @param query
 * @returns {*}
 */

export const listHatch = (query?: HatchQuery): AxiosPromise<HatchVO[]> => {
  return request({
    url: '/chicken/hatch/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询小鸡孵化详细
 * @param id
 */
export const getHatch = (id: string | number): AxiosPromise<HatchVO> => {
  return request({
    url: '/chicken/hatch/' + id,
    method: 'get'
  });
};

/**
 * 新增小鸡孵化
 * @param data
 */
export const addHatch = (data: HatchForm) => {
  return request({
    url: '/chicken/hatch',
    method: 'post',
    data: data
  });
};

/**
 * 修改小鸡孵化
 * @param data
 */
export const updateHatch = (data: HatchForm) => {
  return request({
    url: '/chicken/hatch',
    method: 'put',
    data: data
  });
};

/**
 * 删除小鸡孵化
 * @param id
 */
export const delHatch = (id: string | number | Array<string | number>) => {
  return request({
    url: '/chicken/hatch/' + id,
    method: 'delete'
  });
};
